/**
 * Copyright (c) 2010-2011 Pierre Labatut
 *
 * This file is part of Space-Chronicles project.
 *
 * Space-Chronicles is free software: you can redistribute it and/or modify it
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or <http://code.google.com/p/space-chronicles/>.
 */

package space.glsl;

import space.gl.RenderContext;
import space.math.Vector3f;

/**
 *
 * @author Pierre
 */
public class GLSLMaterial {

    private final String shininessName;
    private final String specularColorName;
    final float shininess;
    final Vector3f specularColor;

    public GLSLMaterial(final String name, float shininess, final Vector3f specularColor) {
        if (specularColor == null) {
            throw new IllegalArgumentException();
        }
        this.shininessName = name + ".shininess";
        this.shininess = shininess;
        this.specularColorName = name + ".specularColor";
        this.specularColor = specularColor;
    }

    public void applyUniform(final RenderContext rc) {
        rc.applyUniform3f(specularColorName, specularColor);
        rc.applyUniform1f(shininessName, shininess);
    }
}
